home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Modules / errnomodule.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-10  |  23.3 KB  |  800 lines

  1. /* Errno module */
  2.  
  3. #include "Python.h"
  4.  
  5. #include "protos/errnomodule.h"
  6.  
  7. /* Mac with GUSI has more errors than those in errno.h */
  8. #ifdef USE_GUSI
  9. #include <sys/errno.h>
  10. #endif
  11.  
  12. /* Windows socket errors (WSA*): XXX is this the correct path ???  */
  13. #ifdef MS_WINDOWS
  14. #include <winsock.h>
  15. #endif
  16.  
  17. /*
  18.  * Pull in the system error definitions
  19.  */ 
  20.  
  21. static PyMethodDef errno_methods[] = {
  22.     {NULL,              NULL}
  23. };
  24.  
  25. /* Helper function doing the dictionary inserting */
  26.  
  27. static void
  28. _inscode(d, de, name, code)
  29.     PyObject *d;
  30.     PyObject *de;
  31.     char *name;
  32.     int code;
  33. {
  34.     PyObject *u;
  35.     PyObject *v;
  36.  
  37.     u = PyString_FromString(name);
  38.     v = PyInt_FromLong((long) code);
  39.  
  40.     if (!u || !v) {
  41.         /* Don't bother reporting this error */
  42.         PyErr_Clear();
  43.     }
  44.     else {
  45.         /* insert in modules dict */
  46.         PyDict_SetItem(d, u, v);
  47.         /* insert in errorcode dict */
  48.         PyDict_SetItem(de, v, u);
  49.     }
  50.     Py_XDECREF(u);
  51.     Py_XDECREF(v);
  52. }
  53.  
  54. static char errno__doc__ [] =
  55. "This module makes available standard errno system symbols.\n\
  56. \n\
  57. The value of each symbol is the corresponding integer value,\n\
  58. e.g., on most systems, errno.ENOENT equals the integer 2.\n\
  59. \n\
  60. The dictionary errno.errorcode maps numeric codes to symbol names,\n\
  61. e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
  62. \n\
  63. Symbols that are not relevant to the underlying system are not defined.\n\
  64. \n\
  65. To map error codes to error messages, use the function os.strerror(),\n\
  66. e.g. os.strerror(2) could return 'No such file or directory'.";
  67.  
  68. DL_EXPORT(void)
  69. initerrno()
  70. {
  71.     PyObject *m, *d, *de;
  72.     m = Py_InitModule3("errno", errno_methods, errno__doc__);
  73.     d = PyModule_GetDict(m);
  74.     de = PyDict_New();
  75.     if (de == NULL || PyDict_SetItemString(d, "errorcode", de))
  76.         Py_FatalError("can't initialize errno module");
  77.  
  78. /* Macro so I don't have to edit each and every line below... */
  79. #define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)
  80.  
  81.     /*
  82.      * The names and comments are borrowed from linux/include/errno.h,
  83.      * which should be pretty all-inclusive
  84.      */ 
  85.  
  86. #ifdef ENODEV
  87.     inscode(d, ds, de, "ENODEV", ENODEV, "No such device");
  88. #endif
  89. #ifdef ENOCSI
  90.     inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
  91. #endif
  92. #ifdef EHOSTUNREACH
  93.     inscode(d, ds, de, "EHOSTUNREACH", EHOSTUNREACH, "No route to host");
  94. #else
  95. #ifdef WSAEHOSTUNREACH
  96.     inscode(d, ds, de, "EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
  97. #endif
  98. #endif
  99. #ifdef ENOMSG
  100.     inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
  101. #endif
  102. #ifdef EUCLEAN
  103.     inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
  104. #endif
  105. #ifdef EL2NSYNC
  106.     inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
  107. #endif
  108. #ifdef EL2HLT
  109.     inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
  110. #endif
  111. #ifdef ENODATA
  112.     inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
  113. #endif
  114. #ifdef ENOTBLK
  115.     inscode(d, ds, de, "ENOTBLK", ENOTBLK, "Block device required");
  116. #endif
  117. #ifdef ENOSYS
  118.     inscode(d, ds, de, "ENOSYS", ENOSYS, "Function not implemented");
  119. #endif
  120. #ifdef EPIPE
  121.     inscode(d, ds, de, "EPIPE", EPIPE, "Broken pipe");
  122. #endif
  123. #ifdef EINVAL
  124.     inscode(d, ds, de, "EINVAL", EINVAL, "Invalid argument");
  125. #else
  126. #ifdef WSAEINVAL
  127.     inscode(d, ds, de, "EINVAL", WSAEINVAL, "Invalid argument");
  128. #endif
  129. #endif
  130. #ifdef EOVERFLOW
  131.     inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
  132. #endif
  133. #ifdef EADV
  134.     inscode(d, ds, de, "EADV", EADV, "Advertise error");
  135. #endif
  136. #ifdef EINTR
  137.     inscode(d, ds, de, "EINTR", EINTR, "Interrupted system call");
  138. #else
  139. #ifdef WSAEINTR
  140.     inscode(d, ds, de, "EINTR", WSAEINTR, "Interrupted system call");
  141. #endif
  142. #endif
  143. #ifdef EUSERS
  144.     inscode(d, ds, de, "EUSERS", EUSERS, "Too many users");
  145. #else
  146. #ifdef WSAEUSERS
  147.     inscode(d, ds, de, "EUSERS", WSAEUSERS, "Too many users");
  148. #endif
  149. #endif
  150. #ifdef ENOTEMPTY
  151.     inscode(d, ds, de, "ENOTEMPTY", ENOTEMPTY, "Directory not empty");
  152. #else
  153. #ifdef WSAENOTEMPTY
  154.     inscode(d, ds, de, "ENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
  155. #endif
  156. #endif
  157. #ifdef ENOBUFS
  158.     inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available");
  159. #else
  160. #ifdef WSAENOBUFS
  161.     inscode(d, ds, de, "ENOBUFS", WSAENOBUFS, "No buffer space available");
  162. #endif
  163. #endif
  164. #ifdef EPROTO
  165.     inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
  166. #endif
  167. #ifdef EREMOTE
  168.     inscode(d, ds, de, "EREMOTE", EREMOTE, "Object is remote");
  169. #else
  170. #ifdef WSAEREMOTE
  171.     inscode(d, ds, de, "EREMOTE", WSAEREMOTE, "Object is remote");
  172. #endif
  173. #endif
  174. #ifdef ENAVAIL
  175.     inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
  176. #endif
  177. #ifdef ECHILD
  178.     inscode(d, ds, de, "ECHILD", ECHILD, "No child processes");
  179. #endif
  180. #ifdef ELOOP
  181.     inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered");
  182. #else
  183. #ifdef WSAELOOP
  184.     inscode(d, ds, de, "ELOOP", WSAELOOP, "Too many symbolic links encountered");
  185. #endif
  186. #endif
  187. #ifdef EXDEV
  188.     inscode(d, ds, de, "EXDEV", EXDEV, "Cross-device link");
  189. #endif
  190. #ifdef E2BIG
  191.     inscode(d, ds, de, "E2BIG", E2BIG, "Arg list too long");
  192. #endif
  193. #ifdef ESRCH
  194.     inscode(d, ds, de, "ESRCH", ESRCH, "No such process");
  195. #endif
  196. #ifdef EMSGSIZE
  197.     inscode(d, ds, de, "EMSGSIZE", EMSGSIZE, "Message too long");
  198. #else
  199. #ifdef WSAEMSGSIZE
  200.     inscode(d, ds, de, "EMSGSIZE", WSAEMSGSIZE, "Message too long");
  201. #endif
  202. #endif
  203. #ifdef EAFNOSUPPORT
  204.     inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
  205. #else
  206. #ifdef WSAEAFNOSUPPORT
  207.     inscode(d, ds, de, "EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
  208. #endif
  209. #endif
  210. #ifdef EBADR
  211.     inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
  212. #endif
  213. #ifdef EHOSTDOWN
  214.     inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down");
  215. #else
  216. #ifdef WSAEHOSTDOWN
  217.     inscode(d, ds, de, "EHOSTDOWN", WSAEHOSTDOWN, "Host is down");
  218. #endif
  219. #endif
  220. #ifdef EPFNOSUPPORT
  221.     inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
  222. #else
  223. #ifdef WSAEPFNOSUPPORT
  224.     inscode(d, ds, de, "EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
  225. #endif
  226. #endif
  227. #ifdef ENOPROTOOPT
  228.     inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
  229. #else
  230. #ifdef WSAENOPROTOOPT
  231.     inscode(d, ds, de, "ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
  232. #endif
  233. #endif
  234. #ifdef EBUSY
  235.     inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy");
  236. #endif
  237. #ifdef EWOULDBLOCK
  238.     inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
  239. #else
  240. #ifdef WSAEWOULDBLOCK
  241.     inscode(d, ds, de, "EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
  242. #endif
  243. #endif
  244. #ifdef EBADFD
  245.     inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state");
  246. #endif
  247. #ifdef EDOTDOT
  248.     inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
  249. #endif
  250. #ifdef EISCONN
  251.     inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected");
  252. #else
  253. #ifdef WSAEISCONN
  254.     inscode(d, ds, de, "EISCONN", WSAEISCONN, "Transport endpoint is already connected");
  255. #endif
  256. #endif
  257. #ifdef ENOANO
  258.     inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
  259. #endif
  260. #ifdef ESHUTDOWN
  261.     inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
  262. #else
  263. #ifdef WSAESHUTDOWN
  264.     inscode(d, ds, de, "ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
  265. #endif
  266. #endif
  267. #ifdef ECHRNG
  268.     inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
  269. #endif
  270. #ifdef ELIBBAD
  271.     inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
  272. #endif
  273. #ifdef ENONET
  274.     inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network");
  275. #endif
  276. #ifdef EBADE
  277.     inscode(d, ds, de, "EBADE", EBADE, "Invalid exchange");
  278. #endif
  279. #ifdef EBADF
  280.     inscode(d, ds, de, "EBADF", EBADF, "Bad file number");
  281. #else
  282. #ifdef WSAEBADF
  283.     inscode(d, ds, de, "EBADF", WSAEBADF, "Bad file number");
  284. #endif
  285. #endif
  286. #ifdef EMULTIHOP
  287.     inscode(d, ds, de, "EMULTIHOP", EMULTIHOP, "Multihop attempted");
  288. #endif
  289. #ifdef EIO
  290.     inscode(d, ds, de, "EIO", EIO, "I/O error");
  291. #endif
  292. #ifdef EUNATCH
  293.     inscode(d, ds, de, "EUNATCH", EUNATCH, "Protocol driver not attached");
  294. #endif
  295. #ifdef EPROTOTYPE
  296.     inscode(d, ds, de, "EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket");
  297. #else
  298. #ifdef WSAEPROTOTYPE
  299.     inscode(d, ds, de, "EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
  300. #endif
  301. #endif
  302. #ifdef ENOSPC
  303.     inscode(d, ds, de, "ENOSPC", ENOSPC, "No space left on device");
  304. #endif
  305. #ifdef ENOEXEC
  306.     inscode(d, ds, de, "ENOEXEC", ENOEXEC, "Exec format error");
  307. #endif
  308. #ifdef EALREADY
  309.     inscode(d, ds, de, "EALREADY", EALREADY, "Operation already in progress");
  310. #else
  311. #ifdef WSAEALREADY
  312.     inscode(d, ds, de, "EALREADY", WSAEALREADY, "Operation already in progress");
  313. #endif
  314. #endif
  315. #ifdef ENETDOWN
  316.     inscode(d, ds, de, "ENETDOWN", ENETDOWN, "Network is down");
  317. #else
  318. #ifdef WSAENETDOWN
  319.     inscode(d, ds, de, "ENETDOWN", WSAENETDOWN, "Network is down");
  320. #endif
  321. #endif
  322. #ifdef ENOTNAM
  323.     inscode(d, ds, de, "ENOTNAM", ENOTNAM, "Not a XENIX named type file");
  324. #endif
  325. #ifdef EACCES
  326.     inscode(d, ds, de, "EACCES", EACCES, "Permission denied");
  327. #else
  328. #ifdef WSAEACCES
  329.     inscode(d, ds, de, "EACCES", WSAEACCES, "Permission denied");
  330. #endif
  331. #endif
  332. #ifdef ELNRNG
  333.     inscode(d, ds, de, "ELNRNG", ELNRNG, "Link number out of range");
  334. #endif
  335. #ifdef EILSEQ
  336.     inscode(d, ds, de, "EILSEQ", EILSEQ, "Illegal byte sequence");
  337. #endif
  338. #ifdef ENOTDIR
  339.     inscode(d, ds, de, "ENOTDIR", ENOTDIR, "Not a directory");
  340. #endif
  341. #ifdef ENOTUNIQ
  342.     inscode(d, ds, de, "ENOTUNIQ", ENOTUNIQ, "Name not unique on network");
  343. #endif
  344. #ifdef EPERM
  345.     inscode(d, ds, de, "EPERM", EPERM, "Operation not permitted");
  346. #endif
  347. #ifdef EDOM
  348.     inscode(d, ds, de, "EDOM", EDOM, "Math argument out of domain of func");
  349. #endif
  350. #ifdef EXFULL
  351.     inscode(d, ds, de, "EXFULL", EXFULL, "Exchange full");
  352. #endif
  353. #ifdef ECONNREFUSED
  354.     inscode(d, ds, de, "ECONNREFUSED", ECONNREFUSED, "Connection refused");
  355. #else
  356. #ifdef WSAECONNREFUSED
  357.     inscode(d, ds, de, "ECONNREFUSED", WSAECONNREFUSED, "Connection refused");
  358. #endif
  359. #endif
  360. #ifdef EISDIR
  361.     inscode(d, ds, de, "EISDIR", EISDIR, "Is a directory");
  362. #endif
  363. #ifdef EPROTONOSUPPORT
  364.     inscode(d, ds, de, "EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported");
  365. #else
  366. #ifdef WSAEPROTONOSUPPORT
  367.     inscode(d, ds, de, "EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
  368. #endif
  369. #endif
  370. #ifdef EROFS
  371.     inscode(d, ds, de, "EROFS", EROFS, "Read-only file system");
  372. #endif
  373. #ifdef EADDRNOTAVAIL
  374.     inscode(d, ds, de, "EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address");
  375. #else
  376. #ifdef WSAEADDRNOTAVAIL
  377.     inscode(d, ds, de, "EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
  378. #endif
  379. #endif
  380. #ifdef EIDRM
  381.     inscode(d, ds, de, "EIDRM", EIDRM, "Identifier removed");
  382. #endif
  383. #ifdef ECOMM
  384.     inscode(d, ds, de, "ECOMM", ECOMM, "Communication error on send");
  385. #endif
  386. #ifdef ESRMNT
  387.     inscode(d, ds, de, "ESRMNT", ESRMNT, "Srmount error");
  388. #endif
  389. #ifdef EREMOTEIO
  390.     inscode(d, ds, de, "EREMOTEIO", EREMOTEIO, "Remote I/O error");
  391. #endif
  392. #ifdef EL3RST
  393.     inscode(d, ds, de, "EL3RST", EL3RST, "Level 3 reset");
  394. #endif
  395. #ifdef EBADMSG
  396.     inscode(d, ds, de, "EBADMSG", EBADMSG, "Not a data message");
  397. #endif
  398. #ifdef ENFILE
  399.     inscode(d, ds, de, "ENFILE", ENFILE, "File table overflow");
  400. #endif
  401. #ifdef ELIBMAX
  402.     inscode(d, ds, de, "ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries");
  403. #endif
  404. #ifdef ESPIPE
  405.     inscode(d, ds, de, "ESPIPE", ESPIPE, "Illegal seek");
  406. #endif
  407. #ifdef ENOLINK
  408.     inscode(d, ds, de, "ENOLINK", ENOLINK, "Link has been severed");
  409. #endif
  410. #ifdef ENETRESET
  411.     inscode(d, ds, de, "ENETRESET", ENETRESET, "Network dropped connection because of reset");
  412. #else
  413. #ifdef WSAENETRESET
  414.     inscode(d, ds, de, "ENETRESET", WSAENETRESET, "Network dropped connection because of reset");
  415. #endif
  416. #endif
  417. #ifdef ETIMEDOUT
  418.     inscode(d, ds, de, "ETIMEDOUT", ETIMEDOUT, "Connection timed out");
  419. #else
  420. #ifdef WSAETIMEDOUT
  421.     inscode(d, ds, de, "ETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
  422. #endif
  423. #endif
  424. #ifdef ENOENT
  425.     inscode(d, ds, de, "ENOENT", ENOENT, "No such file or directory");
  426. #endif
  427. #ifdef EEXIST
  428.     inscode(d, ds, de, "EEXIST", EEXIST, "File exists");
  429. #endif
  430. #ifdef EDQUOT
  431.     inscode(d, ds, de, "EDQUOT", EDQUOT, "Quota exceeded");
  432. #else
  433. #ifdef WSAEDQUOT
  434.     inscode(d, ds, de, "EDQUOT", WSAEDQUOT, "Quota exceeded");
  435. #endif
  436. #endif
  437. #ifdef ENOSTR
  438.     inscode(d, ds, de, "ENOSTR", ENOSTR, "Device not a stream");
  439. #endif
  440. #ifdef EBADSLT
  441.     inscode(d, ds, de, "EBADSLT", EBADSLT, "Invalid slot");
  442. #endif
  443. #ifdef EBADRQC
  444.     inscode(d, ds, de, "EBADRQC", EBADRQC, "Invalid request code");
  445. #endif
  446. #ifdef ELIBACC
  447.     inscode(d, ds, de, "ELIBACC", ELIBACC, "Can not access a needed shared library");
  448. #endif
  449. #ifdef EFAULT
  450.     inscode(d, ds, de, "EFAULT", EFAULT, "Bad address");
  451. #else
  452. #ifdef WSAEFAULT
  453.     inscode(d, ds, de, "EFAULT", WSAEFAULT, "Bad address");
  454. #endif
  455. #endif
  456. #ifdef EFBIG
  457.     inscode(d, ds, de, "EFBIG", EFBIG, "File too large");
  458. #endif
  459. #ifdef EDEADLK
  460.     inscode(d, ds, de, "EDEADLK", EDEADLK, "Resource deadlock would occur");
  461. #endif
  462. #ifdef ENOTCONN
  463.     inscode(d, ds, de, "ENOTCONN", ENOTCONN, "Transport endpoint is not connected");
  464. #else
  465. #ifdef WSAENOTCONN
  466.     inscode(d, ds, de, "ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
  467. #endif
  468. #endif
  469. #ifdef EDESTADDRREQ
  470.     inscode(d, ds, de, "EDESTADDRREQ", EDESTADDRREQ, "Destination address required");
  471. #else
  472. #ifdef WSAEDESTADDRREQ
  473.     inscode(d, ds, de, "EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
  474. #endif
  475. #endif
  476. #ifdef ELIBSCN
  477.     inscode(d, ds, de, "ELIBSCN", ELIBSCN, ".lib section in a.out corrupted");
  478. #endif
  479. #ifdef ENOLCK
  480.     inscode(d, ds, de, "ENOLCK", ENOLCK, "No record locks available");
  481. #endif
  482. #ifdef EISNAM
  483.     inscode(d, ds, de, "EISNAM", EISNAM, "Is a named type file");
  484. #endif
  485. #ifdef ECONNABORTED
  486.     inscode(d, ds, de, "ECONNABORTED", ECONNABORTED, "Software caused connection abort");
  487. #else
  488. #ifdef WSAECONNABORTED
  489.     inscode(d, ds, de, "ECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
  490. #endif
  491. #endif
  492. #ifdef ENETUNREACH
  493.     inscode(d, ds, de, "ENETUNREACH", ENETUNREACH, "Network is unreachable");
  494. #else
  495. #ifdef WSAENETUNREACH
  496.     inscode(d, ds, de, "ENETUNREACH", WSAENETUNREACH, "Network is unreachable");
  497. #endif
  498. #endif
  499. #ifdef ESTALE
  500.     inscode(d, ds, de, "ESTALE", ESTALE, "Stale NFS file handle");
  501. #else
  502. #ifdef WSAESTALE
  503.     inscode(d, ds, de, "ESTALE", WSAESTALE, "Stale NFS file handle");
  504. #endif
  505. #endif
  506. #ifdef ENOSR
  507.     inscode(d, ds, de, "ENOSR", ENOSR, "Out of streams resources");
  508. #endif
  509. #ifdef ENOMEM
  510.     inscode(d, ds, de, "ENOMEM", ENOMEM, "Out of memory");
  511. #endif
  512. #ifdef ENOTSOCK
  513.     inscode(d, ds, de, "ENOTSOCK", ENOTSOCK, "Socket operation on non-socket");
  514. #else
  515. #ifdef WSAENOTSOCK
  516.     inscode(d, ds, de, "ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
  517. #endif
  518. #endif
  519. #ifdef ESTRPIPE
  520.     inscode(d, ds, de, "ESTRPIPE", ESTRPIPE, "Streams pipe error");
  521. #endif
  522. #ifdef EMLINK
  523.     inscode(d, ds, de, "EMLINK", EMLINK, "Too many links");
  524. #endif
  525. #ifdef ERANGE
  526.     inscode(d, ds, de, "ERANGE", ERANGE, "Math result not representable");
  527. #endif
  528. #ifdef ELIBEXEC
  529.     inscode(d, ds, de, "ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly");
  530. #endif
  531. #ifdef EL3HLT
  532.     inscode(d, ds, de, "EL3HLT", EL3HLT, "Level 3 halted");
  533. #endif
  534. #ifdef ECONNRESET
  535.     inscode(d, ds, de, "ECONNRESET", ECONNRESET, "Connection reset by peer");
  536. #else
  537. #ifdef WSAECONNRESET
  538.     inscode(d, ds, de, "ECONNRESET", WSAECONNRESET, "Connection reset by peer");
  539. #endif
  540. #endif
  541. #ifdef EADDRINUSE
  542.     inscode(d, ds, de, "EADDRINUSE", EADDRINUSE, "Address already in use");
  543. #else
  544. #ifdef WSAEADDRINUSE
  545.     inscode(d, ds, de, "EADDRINUSE", WSAEADDRINUSE, "Address already in use");
  546. #endif
  547. #endif
  548. #ifdef EOPNOTSUPP
  549.     inscode(d, ds, de, "EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint");
  550. #else
  551. #ifdef WSAEOPNOTSUPP
  552.     inscode(d, ds, de, "EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
  553. #endif
  554. #endif
  555. #ifdef EREMCHG
  556.     inscode(d, ds, de, "EREMCHG", EREMCHG, "Remote address changed");
  557. #endif
  558. #ifdef EAGAIN
  559.     inscode(d, ds, de, "EAGAIN", EAGAIN, "Try again");
  560. #endif
  561. #ifdef ENAMETOOLONG
  562.     inscode(d, ds, de, "ENAMETOOLONG", ENAMETOOLONG, "File name too long");
  563. #else
  564. #ifdef WSAENAMETOOLONG
  565.     inscode(d, ds, de, "ENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
  566. #endif
  567. #endif
  568. #ifdef ENOTTY
  569.     inscode(d, ds, de, "ENOTTY", ENOTTY, "Not a typewriter");
  570. #endif
  571. #ifdef ERESTART
  572.     inscode(d, ds, de, "ERESTART", ERESTART, "Interrupted system call should be restarted");
  573. #endif
  574. #ifdef ESOCKTNOSUPPORT
  575.     inscode(d, ds, de, "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported");
  576. #else
  577. #ifdef WSAESOCKTNOSUPPORT
  578.     inscode(d, ds, de, "ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
  579. #endif
  580. #endif
  581. #ifdef ETIME
  582.     inscode(d, ds, de, "ETIME", ETIME, "Timer expired");
  583. #endif
  584. #ifdef EBFONT
  585.     inscode(d, ds, de, "EBFONT", EBFONT, "Bad font file format");
  586. #endif
  587. #ifdef EDEADLOCK
  588.     inscode(d, ds, de, "EDEADLOCK", EDEADLOCK, "Error EDEADLOCK");
  589. #endif
  590. #ifdef ETOOMANYREFS
  591.     inscode(d, ds, de, "ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice");
  592. #else
  593. #ifdef WSAETOOMANYREFS
  594.     inscode(d, ds, de, "ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
  595. #endif
  596. #endif
  597. #ifdef EMFILE
  598.     inscode(d, ds, de, "EMFILE", EMFILE, "Too many open files");
  599. #else
  600. #ifdef WSAEMFILE
  601.     inscode(d, ds, de, "EMFILE", WSAEMFILE, "Too many open files");
  602. #endif
  603. #endif
  604. #ifdef ETXTBSY
  605.     inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy");
  606. #endif
  607. #ifdef EINPROGRESS
  608.     inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress");
  609. #else
  610. #ifdef WSAEINPROGRESS
  611.     inscode(d, ds, de, "EINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
  612. #endif
  613. #endif
  614. #ifdef ENXIO
  615.     inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address");
  616. #endif
  617. #ifdef ENOPKG
  618.     inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
  619. #endif
  620. #ifdef WSASY
  621.     inscode(d, ds, de, "WSASY", WSASY, "Error WSASY");
  622. #endif
  623. #ifdef WSAEHOSTDOWN
  624.     inscode(d, ds, de, "WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down");
  625. #endif
  626. #ifdef WSAENETDOWN
  627.     inscode(d, ds, de, "WSAENETDOWN", WSAENETDOWN, "Network is down");
  628. #endif
  629. #ifdef WSAENOTSOCK
  630.     inscode(d, ds, de, "WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
  631. #endif
  632. #ifdef WSAEHOSTUNREACH
  633.     inscode(d, ds, de, "WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
  634. #endif
  635. #ifdef WSAELOOP
  636.     inscode(d, ds, de, "WSAELOOP", WSAELOOP, "Too many symbolic links encountered");
  637. #endif
  638. #ifdef WSAEMFILE
  639.     inscode(d, ds, de, "WSAEMFILE", WSAEMFILE, "Too many open files");
  640. #endif
  641. #ifdef WSAESTALE
  642.     inscode(d, ds, de, "WSAESTALE", WSAESTALE, "Stale NFS file handle");
  643. #endif
  644. #ifdef WSAVERNOTSUPPORTED
  645.     inscode(d, ds, de, "WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED");
  646. #endif
  647. #ifdef WSAENETUNREACH
  648.     inscode(d, ds, de, "WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable");
  649. #endif
  650. #ifdef WSAEPROCLIM
  651.     inscode(d, ds, de, "WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM");
  652. #endif
  653. #ifdef WSAEFAULT
  654.     inscode(d, ds, de, "WSAEFAULT", WSAEFAULT, "Bad address");
  655. #endif
  656. #ifdef WSANOTINITIALISED
  657.     inscode(d, ds, de, "WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED");
  658. #endif
  659. #ifdef WSAEUSERS
  660.     inscode(d, ds, de, "WSAEUSERS", WSAEUSERS, "Too many users");
  661. #endif
  662. #ifdef WSAMAKEASYNCREPL
  663.     inscode(d, ds, de, "WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL");
  664. #endif
  665. #ifdef WSAENOPROTOOPT
  666.     inscode(d, ds, de, "WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
  667. #endif
  668. #ifdef WSAECONNABORTED
  669.     inscode(d, ds, de, "WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
  670. #endif
  671. #ifdef WSAENAMETOOLONG
  672.     inscode(d, ds, de, "WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
  673. #endif
  674. #ifdef WSAENOTEMPTY
  675.     inscode(d, ds, de, "WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
  676. #endif
  677. #ifdef WSAESHUTDOWN
  678.     inscode(d, ds, de, "WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
  679. #endif
  680. #ifdef WSAEAFNOSUPPORT
  681.     inscode(d, ds, de, "WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
  682. #endif
  683. #ifdef WSAETOOMANYREFS
  684.     inscode(d, ds, de, "WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
  685. #endif
  686. #ifdef WSAEACCES
  687.     inscode(d, ds, de, "WSAEACCES", WSAEACCES, "Permission denied");
  688. #endif
  689. #ifdef WSATR
  690.     inscode(d, ds, de, "WSATR", WSATR, "Error WSATR");
  691. #endif
  692. #ifdef WSABASEERR
  693.     inscode(d, ds, de, "WSABASEERR", WSABASEERR, "Error WSABASEERR");
  694. #endif
  695. #ifdef WSADESCRIPTIO
  696.     inscode(d, ds, de, "WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO");
  697. #endif
  698. #ifdef WSAEMSGSIZE
  699.     inscode(d, ds, de, "WSAEMSGSIZE", WSAEMSGSIZE, "Message too long");
  700. #endif
  701. #ifdef WSAEBADF
  702.     inscode(d, ds, de, "WSAEBADF", WSAEBADF, "Bad file number");
  703. #endif
  704. #ifdef WSAECONNRESET
  705.     inscode(d, ds, de, "WSAECONNRESET", WSAECONNRESET, "Connection reset by peer");
  706. #endif
  707. #ifdef WSAGETSELECTERRO
  708.     inscode(d, ds, de, "WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO");
  709. #endif
  710. #ifdef WSAETIMEDOUT
  711.     inscode(d, ds, de, "WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
  712. #endif
  713. #ifdef WSAENOBUFS
  714.     inscode(d, ds, de, "WSAENOBUFS", WSAENOBUFS, "No buffer space available");
  715. #endif
  716. #ifdef WSAEDISCON
  717.     inscode(d, ds, de, "WSAEDISCON", WSAEDISCON, "Error WSAEDISCON");
  718. #endif
  719. #ifdef WSAEINTR
  720.     inscode(d, ds, de, "WSAEINTR", WSAEINTR, "Interrupted system call");
  721. #endif
  722. #ifdef WSAEPROTOTYPE
  723.     inscode(d, ds, de, "WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
  724. #endif
  725. #ifdef WSAHOS
  726.     inscode(d, ds, de, "WSAHOS", WSAHOS, "Error WSAHOS");
  727. #endif
  728. #ifdef WSAEADDRINUSE
  729.     inscode(d, ds, de, "WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use");
  730. #endif
  731. #ifdef WSAEADDRNOTAVAIL
  732.     inscode(d, ds, de, "WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
  733. #endif
  734. #ifdef WSAEALREADY
  735.     inscode(d, ds, de, "WSAEALREADY", WSAEALREADY, "Operation already in progress");
  736. #endif
  737. #ifdef WSAEPROTONOSUPPORT
  738.     inscode(d, ds, de, "WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
  739. #endif
  740. #ifdef WSASYSNOTREADY
  741.     inscode(d, ds, de, "WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY");
  742. #endif
  743. #ifdef WSAEWOULDBLOCK
  744.     inscode(d, ds, de, "WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
  745. #endif
  746. #ifdef WSAEPFNOSUPPORT
  747.     inscode(d, ds, de, "WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
  748. #endif
  749. #ifdef WSAEOPNOTSUPP
  750.     inscode(d, ds, de, "WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
  751. #endif
  752. #ifdef WSAEISCONN
  753.     inscode(d, ds, de, "WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected");
  754. #endif
  755. #ifdef WSAEDQUOT
  756.     inscode(d, ds, de, "WSAEDQUOT", WSAEDQUOT, "Quota exceeded");
  757. #endif
  758. #ifdef WSAENOTCONN
  759.     inscode(d, ds, de, "WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
  760. #endif
  761. #ifdef WSAEREMOTE
  762.     inscode(d, ds, de, "WSAEREMOTE", WSAEREMOTE, "Object is remote");
  763. #endif
  764. #ifdef WSAEINVAL
  765.     inscode(d, ds, de, "WSAEINVAL", WSAEINVAL, "Invalid argument");
  766. #endif
  767. #ifdef WSAEINPROGRESS
  768.     inscode(d, ds, de, "WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
  769. #endif
  770. #ifdef WSAGETSELECTEVEN
  771.     inscode(d, ds, de, "WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN");
  772. #endif
  773. #ifdef WSAESOCKTNOSUPPORT
  774.     inscode(d, ds, de, "WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
  775. #endif
  776. #ifdef WSAGETASYNCERRO
  777.     inscode(d, ds, de, "WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO");
  778. #endif
  779. #ifdef WSAMAKESELECTREPL
  780.     inscode(d, ds, de, "WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL");
  781. #endif
  782. #ifdef WSAGETASYNCBUFLE
  783.     inscode(d, ds, de, "WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE");
  784. #endif
  785. #ifdef WSAEDESTADDRREQ
  786.     inscode(d, ds, de, "WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
  787. #endif
  788. #ifdef WSAECONNREFUSED
  789.     inscode(d, ds, de, "WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused");
  790. #endif
  791. #ifdef WSAENETRESET
  792.     inscode(d, ds, de, "WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset");
  793. #endif
  794. #ifdef WSAN
  795.     inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
  796. #endif
  797.  
  798.     Py_DECREF(de);
  799. }
  800.